//
//  UserInfoClass.m
//  TelemedCloud
//
//  Created by YT on 2018/5/8.
//  Copyright © 2018年 YT. All rights reserved.
//

#import "UserInfoClass.h"

#define UserInfoKey @"UserInfoKey" //用户信息key

@implementation UserInfoClass


+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
    return YES;
}

+ (instancetype)share {
    static UserInfoClass *share = nil;
    static dispatch_once_t onceT;
    dispatch_once(&onceT, ^{
        share = [self new];
    });
    return share;
}

- (void)loginWithInfo:(NSDictionary*)info {
    
//    [[NSUserDefaults standardUserDefaults] setObject:info forKey:UserInfoKey];
//    [[NSUserDefaults standardUserDefaults] synchronize];
//    [self dealWithLoginInfo:info];
    [UserInfoClass share].login = YES;
    [[UserInfoClass share] setValuesForKeysWithDictionary:info];
     //登录IM
}
//- (void)dealWithLoginInfo:(UserInfoClass *)info {
//    [UserInfoClass share].login = YES;
//    [UserInfoClass share].mid = info.mid;
//    [UserInfoClass share].isFamily = info.isFamily;
//    [UserInfoClass share].sexId = info.sexId;
//    [UserInfoClass share].userId = info.userId;
//    [UserInfoClass share].imageId = info.imageId;
//    [UserInfoClass share].comFlag = info.comFlag;
//    [UserInfoClass share].meetingType = info.meetingType;
//    [UserInfoClass share].pid = info.pid;
//    [UserInfoClass share].imUserSign = info.imUserSign;
//    [UserInfoClass share].meetingNo = info.meetingNo;
//    [UserInfoClass share].meetingPw = info.meetingPw;
//    [UserInfoClass share].memName = info.memName;
//    [UserInfoClass share].imId = info.imId;
//    [UserInfoClass share].sex = info.sex;
//    [UserInfoClass share].userIdSign = info.userIdSign;
//    [UserInfoClass share].loginUser = info.loginUser;
//}




- (void)clearUserInfo {
    [UserInfoClass share].login = NO;
    [UserInfoClass share].mid = 0;
    [UserInfoClass share].isFamily = 0;
    [UserInfoClass share].sexId = 0;
    [UserInfoClass share].userId = 0;
    [UserInfoClass share].imageId = 0;
    [UserInfoClass share].comFlag = 0;
    [UserInfoClass share].meetingType = 0;
    [UserInfoClass share].pid = 0;
    [UserInfoClass share].imUserSign = nil;
    [UserInfoClass share].meetingNo = nil;
    [UserInfoClass share].meetingPw = nil;
    [UserInfoClass share].memName = nil;
    [UserInfoClass share].imId = nil;
    [UserInfoClass share].sex = nil;
    [UserInfoClass share].userIdSign = nil;
    [UserInfoClass share].loginUser = nil;
//    [[NSUserDefaults standardUserDefaults] removeObjectForKey:UserInfoKey];
}

@end
